//
//  EFNavigationController.m
//  EFHealth
//
//  Created by liumadu on 14-11-28.
//  Copyright (c) 2018年 ef. All rights reserved.
//

#import "EFNavigationController.h"

#import "AppMacro.h"
#import "PublicUtils.h"

@interface EFNavigationController()
//@property (nonatomic,assign)BOOL isSwitching ;
@end
@implementation EFNavigationController


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        
        //        self.wantsFullScreenLayout = YES;
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.navigationBarHidden = NO ;// 使导航条有效
    self.navigationBar.hidden = YES ;// 隐藏导航条，但由于导航条有效，系统的返回按钮页有效，所以可以使用系统的右滑返回手势。
}

- (void)dragCanBack:(BOOL)canBack
{
    self.interactivePopGestureRecognizer.enabled = canBack;
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    
    if (self.viewControllers.count > 0 ) {
        viewController.hidesBottomBarWhenPushed = YES;   //这个必须写在super前面, 否则跳转已经过了
    }
    [super pushViewController:viewController animated:animated];  //要写这个,否则不跳转了
    
}

//- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
//}

//- (UIViewController *)popViewControllerAnimated:(BOOL)animated
//{
//    EFLog(@"popVC=====");
//    return [super popViewControllerAnimated:YES];
//}

- (void)pushViewControllerRetro:(UIViewController *)viewController {
    CATransition *transition = [CATransition animation];
    transition.duration = 0.25;
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    transition.type = kCATransitionPush;
    transition.subtype = kCATransitionFromRight;
    [self.view.layer addAnimation:transition forKey:nil];
    
    [self pushViewController:viewController animated:NO];
}

- (void)popViewControllerRetro {
    CATransition *transition = [CATransition animation];
    transition.duration = 0.25;
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    transition.type = kCATransitionPush;
    transition.subtype = kCATransitionFromLeft;
    [self.view.layer addAnimation:transition forKey:nil];
    
    [self popViewControllerAnimated:NO];
}
- (UIStatusBarStyle)preferredStatusBarStyle
{
    return UIStatusBarStyleDarkContent;
}
@end











